﻿@using Microsoft.AspNetCore.Mvc.ModelBinding;
@using Admin.IdentityServer.Models.ViewModels;
@model ConsentViewModel
<p>Consent Page</p>
<!--Client Info-->
<div class="row page-header">
    <div class="col-sm-10">
        @if (!string.IsNullOrWhiteSpace(Model.ClientLogoUrl))
        {
            <div><img src="@Model.ClientLogoUrl" /></div>
        }

        <h1>
            @Model.ClientId
            <small>希望使用您的账户</small>
        </h1>
    </div>
</div>

<!--Scope Info-->
<div class="row">
    <div class="col-sm-8">

        <div asp-validation-summary="All" class="danger"></div>

        <form asp-action="Index" method="post">
            <input type="hidden" asp-for="ReturnUrl" />

            @if (Model.IdentityScopes.Any())
            {
                <div>
                    <div class="panel-heading">
                        <span class="glyphicon glyphicon-user"></span>
                        用户信息
                    </div>
                    <ul class="list-group">
                        @foreach (var scope in Model.IdentityScopes)
                        {
                            @Html.Partial("_ScopeListitem", scope)
                        }
                    </ul>
                </div>
            }
            @if (Model.ResourceScopes.Any())
            {
                <div>
                    <div class="panel-heading">
                        <span class="glyphicon glyphicon-tasks"></span>
                        应用权限
                    </div>
                    <ul class="list-group">
                        @foreach (var scope in Model.ResourceScopes)
                        {
                            @Html.Partial("_ScopeListitem", scope)
                        }
                    </ul>
                </div>
            }

            <div>
                <label>
                    <input type="checkbox" asp-for="RememberConsent" />
                    <strong>记住我的选择</strong>
                </label>
            </div>

            <div>
                <button name="button" value="yes" class="btn btn-primary" autofocus>同意</button>
                <button name="button" value="no">取消</button>
                @if (!string.IsNullOrEmpty(Model.ClientUrl))
                {
                    <a href="@Model.ClientUrl" class="pull-right btn btn-default">
                        <span class="glyphicon glyphicon-info-sign"></span>
                        <strong>@Model.ClientUrl</strong>
                    </a>
                }
            </div>
        </form>
    </div>
</div>
